<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增实时材料')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-sscl-add">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">资料标题：</label>
                    <div class="col-sm-8">
                        <input name="title" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">内容分类：</label>
                    <div class="col-sm-8">
                        <select name="category" class="form-control" id="category">
                            <option value="GZHY">工作会议</option>
                            <option value="TZGG">通知公告</option>
                            <option value="ZCWJ">政策文件</option>
                            <option value="XXCL">学习材料</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">是否启用：</label>
                    <div class="col-sm-8">
                        <input name="status" type="radio" value="0" />
                        <label >不启用</label>
                        <input name="status" type="radio" value="1" checked/>
                        <label >启用</label>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">来源：</label>
                    <div class="col-sm-8">
                        <input name="source" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">内容类型：</label>
                    <div class="col-sm-8">
                        <select name="contentType" class="form-control" id="contentType">
                            <option value="pdf">PDF文件</option>
                            <option value="doc">DOC文件</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">描述信息：</label>
                    <div class="col-sm-8">
                        <input name="info" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">资料内容URL：</label>
                    <div class="col-sm-8">
                        <input type="hidden" name="contentUrl">
                        <div class="file-loading">
                            <input class="form-control file-upload" id="contentUrl" name="file" type="file">
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">发布时间：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="publishTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "learn/sscl"
        $("#form-sscl-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-sscl-add').serialize());
            }
        }

        $("input[name='publishTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(".file-upload").fileinput({
            uploadUrl: ctx + 'common/upload',
            maxFileCount: 1,
            autoReplace: true
        }).on('fileuploaded', function (event, data, previewId, index) {
            $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')
        })
    </script>
</body>
</html>